The online racing simulator
Searching in All forums
(951 results)
Yisc[NL]
S3 licensed
Sure, you can do such thing with Lapper.
You will need to make a command like:

CASE "!siren"

So if someone types '!horn' in chat a sub event is executed.
In that sub event you need to send a command to LFS, like:

cmdLFS("/siren fast");
Yisc[NL]
S3 licensed
Quote from mbutcher :Yes. It's been fine for about a month but it started again today at lunch time. Sadly it's at the time when we're running our Gumball event. Frown

That's probably related then.
As said, very sad and I hope you guys will be able to solve it soon again.
Best of luck.
Yisc[NL]
S3 licensed
Seriously?
Is this still or again going on, what a sad people who keep doing that Frown
Yisc[NL]
S3 licensed
Although the error suggests that a semicolon is missing, which can be the real problem in some cases, that same error is also given when an empty value is inserted, which causes "" get together and is read as a closure of a piece of code.
Add this to your code and see what is actualy written on the console of Lapper:

writeline ( "Distancia_" . $track . "_" . $car . "_" . $username );
Yisc[NL]
S3 licensed
And what did you to to debug your code?
My answer is not meant to be annoying, but learning to debug code is essential to become a better code writer.
A few thing you could check in order of importance:

- Is the value actualy stored in the database when a player disconnects?
- If above question can be answered with 'yes', is the value correcly retrieved when a player connects?
- If that answer is 'yes' as well, then there must be an issue in the sub that is supposed to show the button
Yisc[NL]
S3 licensed
Yeah, that would work perfectly
Yisc[NL]
S3 licensed
Look in folder 'Doc' for file 'changes.txt', you can find explanation there.
Otherwise look at my or other peoples Lapper script to see how to use it.
Yisc[NL]
S3 licensed
In the OnConnect event you need to retrieve the value using 'getuserstoredvalue'.
In the OnDisconnect event you need to store the value using 'setuserstoredvalue' or save it when passing start/finish
Yisc[NL]
S3 licensed
To do that, you have to store the value when the user disconnects and retrieve it from the database when the user connects again.
Yisc[NL]
S3 licensed
Sure, if he gives you the admin password and you logon to the server using that password, you will be admin too.
He has to make sure there are enough admin slots available, which can be configured in the server config file.
Yisc[NL]
S3 licensed
Why trying to invent the wheel over and over again?
There are drag-systems out there and if you don't like how they work, adjust them to your own needs.
Paying someone 5 Dollars won't get you anywhere in terms of getting someone to build something for you.
You ask a lot of question in the whole programmer section, but the questions keep coming, while there's no evidence of progress or you trying to do anything your self.
Yisc[NL]
S3 licensed
When that button is pressed, the following function should be executed:

/run newbie.lfs

Open a new text file and add the following lines:

/press enter
/join
/press space

Save the script with name "newbie.lfs" in 'data\script' of your LFS directory.

This will certainly work, the only question remaining is, will the right command work at the right moment.
You would thing that setting READY and joining a race, isn't doing anything when you are already in a race.
So when the button is pressed during a race, it will only execute the 3rd option (aka put car back on wheels).
But you would need to test that, to be sure.

In case that isn't working as you would like, then there isn't an IF/ELSE construction possibile in such LFS scripts, so either you go the route of assigning 3 buttons then, or you do something using an Insim application.
Yisc[NL]
S3 licensed
Very nice that server and software of yours.
Keep up the good work Smile
Yisc[NL]
S3 licensed
Working perfectly here.
Button is shown when you connect to the server:


When you click the button, you get to see the 'law':


I have uploaded the script, download the file, rename it to "law_buttons.lpr" and place it in the includes folder of Lapper.

Then open the file "addonsused.lpr" from that same folder.
Add a line saying: include( "./law_buttons.lpr");
Save the file and (re)start Lapper.
Yisc[NL]
S3 licensed
This piece of code:

openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );

Should go in the Onconnect or OnConnectClose (in case you have a welcome screen that people have to click to close it) event.
Since it's best not to put your own code in the standard Lapper script, it should all go in seperate modules, like this:

#The code above tells Lapper that when the OnConnect event is triggered (by someone connecting to the server), it should also execute an extra piece of code
CatchEvent OnConnect( $userName )
OnConnect_law_button();
EndCatchEvent

#Sub routine that is executed when someone connects to the server
Sub Onconnect_law_button()
openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );
EndSub

#Sub routine that is executed when someone has clicked the button displayed in sub routine 'Onconnect_law_button'
Sub Laws ( $KeyFlags, $id )
Do something here to show the laws, starting by closing the button that just has been clicked
closePrivButton("law_button");
openPrivButton( "law_1",32,0,138,7,5,-1,16,"RTFM = Read the f*cking manual ;-)" );
EndSub

Save this code into a module and store it in the 'includes' folder.
Let's say we name the module: law_buttons.lpr

Then open the file called 'addonsused.lpr' (can also be found in the 'includes' folder) and add the following line, before saving it:

include( "./law_buttons.lpr");
Yisc[NL]
S3 licensed
If you take the code you already posted:

openPrivButton( "hud_bg",32,0,138,7,5,-1,16,"" );

hug_bg = name of the button
32 = Left coordinate of the button (value between 0 and 200,0 is extreme left, 200 is extreme right)
0 = Top coordinate of the button (value between 0 and 200,0 is extreme top of screen, 200 is extreme bottom of screen)
138 = Width of the button (or how long is your button)
7 = Height of the button (or how deep is your button)
5 = Space between multiple lines of text displayed in the button
-1 = Duration the button is shown (-1 means that it stays on screen, until it is clicked)
16 = Colour of the button (* see below for more explanation)
"" = The Text displayed on the button

And then you can add one more value to a button, which is the name of the sub-routine you want to call, when someone clicks the button (this is optional)

So if you make something like this:

openPrivButton( "law_button",32,0,138,7,5,-1,16,"Read Law",Laws );

Sub Laws ( $KeyFlags, $id )
#Do something here to show the laws, starting by closing the button that just has been clicked
closePrivButton("law_button");
openPrivButton( "law_1",32,0,138,7,5,-1,16,"RTFM = Read the f*cking manual ;-)" );
EndSub

* Codes that can be used on button format:

0 - transparent button
16 - light button
32 - dark button
64 - align text to left
128 - align text to right

If you want to make a light colored button with text aligned to the left, combine the codes to one new code, for example 16+64 = 80
Yisc[NL]
S3 licensed
You haven't set the number of classes, which probably is the reason for the overlapping buttons.
Yisc[NL]
S3 licensed
Best thing to do is to place these buttons in the OnConnect section.
Use this as example and put that in a new lpr file and save that in the 'includes' folder of your Lapper directory:


CatchSub OnConnectClose( $KeyFlags,$id )
OnConnectClose_Info();
EndCatchSub

Sub OnConnectClose_Info()
openPrivButton( "hud_bg",32,0,138,7,5,-1,16,"" );
openPrivButton( "info_1",33,1,30,5,5,2,96,"^7My Server" );
EndSub

Also make sure to adjust file 'addonsused.lpr' and add a line saying:

include( "./servergui.lpr");

Where 'servergui.lpr' should be the same filename as you just used to store the code above into.
Yisc[NL]
S3 licensed
I always like to help people, but have no clue what you want help with.
Please explain in details what you want and show the script(s) you already have, so things will make sense.
Yisc[NL]
S3 licensed
That's very weird, but if it works, it works Smile
Just tested and it does work.
Any chance you can figure out why that's needed?
Other request would be able to unset one value from the array, instead of the whole array using the unset feature.
My test-script had two bugs, which are adjusted in the code below (in case anyone might be interested to use it):


CatchEvent OnLapperStart()
OnLapperStart_Test();
EndCatchEvent

Sub OnLapperStart_Test()
GlobalVar $number_array;
GlobalVar $new_number_array;

$number_array[0]=1;
$number_array[1]=2;
$number_array[2]=3;
$number_array[3]=4;
$number_array[4]=5;
$number_array[5]=6;
$number_array[6]=7;
$number_array[7]=8;
EndSub

CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");

IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF

SWITCH( $command )
CASE "!testarr":
testarr ( $KeyFlags , $argv );
BREAK;
ENDSWITCH
EndCatchEvent

Sub testarr( $KeyFlags,$id )
$NewArray = $number_array;
dumpVar ($NewArray);
$counter=0;
FOREACH( $val IN $NewArray)
writeline ( "DEBUG ARR: " . $val["value"] );
IF ($val["value" ] != 3)
THEN
$new_number_array[$counter] = "" . $val["value" ];
$counter=$counter+1;
ENDIF
ENDFOREACH

dumpVar ($new_number_array);
EndSub

Problem with FOREACH
Yisc[NL]
S3 licensed
Either there's a problem with FOREACH in Lapper or I am missing a trick.
See code below.
The dumpVar in Sub 'testarr' is displaying the array that is filled on the start of Lapper.
But then the FOREACH-loop should start and for some reason that isn't happening.
I had it in a normal sub first, and now put it in a sub started by typing: !testarr
What am I missing here or has this loop-function gone broken at some point?


CatchEvent OnLapperStart()
OnLapperStart_Test();
EndCatchEvent

Sub OnLapperStart_Test()
GlobalVar $number_array;
GlobalVar $new_number_array;

$number_array[0]=1;
$number_array[1]=2;
$number_array[2]=3;
$number_array[3]=4;
$number_array[4]=5;
$number_array[5]=6;
$number_array[6]=7;
$number_array[7]=8;
EndSub

CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");

IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF

SWITCH( $command )
CASE "!testarr":
testarr ( $KeyFlags , $argv );
BREAK;
ENDSWITCH
EndCatchEvent

Sub testarr( $KeyFlags,$id )
dumpVar ($number_array);
$counter=0;
FOREACH( $val IN $number_array)
writeline ( "DEBUG ARR: " . $val["value"] );
IF ($val["value" ] != 3)
THEN
$new_number_array[$counter] = $val["value" ];
ENDIF

$counter=$counter+1;
ENDFOREACH

dumpVar ($new_number_array);
EndSub

Yisc[NL]
S3 licensed
No, the error means you are mishandling an array Smile
Yisc[NL]
S3 licensed
Well, that depends how you want to go about it.
If you want to send the first 4 people to a different location that reach that node, you can use a simple counter.
If the first person that reaches the node, triggers the action, you will need to find a way to pick out the other 3.
In case they are in a race, it would be easy to select the number 2,3 and 4 and re-locate them.
Maybe I am missing something, but all of the above seems relatively easy to accomplish with Lapper.
Yisc[NL]
S3 licensed
You can do that using RegisterNodeAction and then a Sub-routine to do the spawning.
Yisc[NL]
S3 licensed
At the moment, I am not making anything, but have worked on a cruise-script in the past (search CfL (Cruise for Lapper)) and have assisted others with their cruise-scripts.
The main thing I noticed in these scripts, is that they are static, while I think it would be great to have a dynamic script, that can be used on any track and any configuration, without having the adjust the script it self.
Since Lapper has a database attached, I think that should be doable, but since I don't cruise myself, I am interested to hear what such script would need to contain (like must haves and nice to have features).
FGED GREDG RDFGDR GSFDG